package edu.sju.ssm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

public class Book implements Serializable {
	private static final long serialVersionUID = 1L;

	private Integer id;
	private String title;
	private LocalDate datePublished;
	private BigDecimal price;

	public Book() {
	}

	public Book(Integer id, String title, LocalDate datePublished, BigDecimal price) {
		this.id = id;
		this.title = title;
		this.datePublished = datePublished;
		this.price = price;
	}
	
	public Book(String title, LocalDate datePublished, BigDecimal price) {
		this.title = title;
		this.datePublished = datePublished;
		this.price = price;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public LocalDate getDatePublished() {
		return datePublished;
	}

	public void setDatePublished(LocalDate datePublished) {
		this.datePublished = datePublished;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	@Override
	public String toString() {
		return String.format("%d：《%s》，出版日期：%s，价格：%.2f", id, title, datePublished, price);
	}
}
